CC = gcc
CFLAGS = -Wall -O2
LDFLAGS = -lncurses

SRC_DIR = src
BIN_DIR = bin

SOURCES = $(SRC_DIR)/main.c $(SRC_DIR)/player.c
OBJECTS = $(SOURCES:.c=.o)
EXECUTABLE = $(BIN_DIR)/music_player

all: $(EXECUTABLE)

$(EXECUTABLE): $(OBJECTS)
	mkdir -p $(BIN_DIR)  # Create the bin directory if it doesn't exist
	$(CC) $(OBJECTS) -o $(EXECUTABLE) $(LDFLAGS)

%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@

clean:
	rm -f $(OBJECTS) $(EXECUTABLE)
